import 'package:english_words/english_words.dart';
import 'package:fish_redux/fish_redux.dart';

import 'state.dart';

enum HomePageAction {
  init,
  onRandomMsg,
  randomMsg,
  onFetch,
  fetch,
  onRefresh,
  refresh
}

class HomePageActionCreator {
  static Action init(HomePageState state) {
    return Action(HomePageAction.init, payload: state);
  }

  static Action randomMSg(HomePageState state) {
    return Action(HomePageAction.randomMsg, payload: state);
  }

  static Action onRandomMsg(HomePageState state) {
    return Action(HomePageAction.onRandomMsg, payload: state);
  }

  static Action onFetch() {
    return Action(HomePageAction.onFetch);
  }

  static Action fetch(List<WordPair> words) {
    return Action(HomePageAction.fetch, payload: words);
  }

  static Action onRefresh() {
    return Action(HomePageAction.onRefresh);
  }

  static Action refresh(List<WordPair> words) {
    return Action(HomePageAction.refresh, payload: words);
  }
}
